.class public final Lcom/burstly/lib/component/networkcomponent/burstly/DayBasedCacheTimer;
.super Ljava/util/concurrent/atomic/AtomicLong;
.source "DayBasedCacheTimer.java"


# static fields
.field private static final LOG:Lcom/burstly/lib/util/LoggerExt; = null

.field private static final TAG:Ljava/lang/String; = "DayBasedCacheTimer"

.field private static final serialVersionUID:J = 0x5e743818cd2892eaL


# instance fields
.field private final mDefaultValue:Ljava/lang/Long;


# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 34
    invoke-static {}, Lcom/burstly/lib/util/LoggerExt;->getInstance()Lcom/burstly/lib/util/LoggerExt;

    move-result-object v0

    sput-object v0, Lcom/burstly/lib/component/networkcomponent/burstly/DayBasedCacheTimer;->LOG:Lcom/burstly/lib/util/LoggerExt;

    return-void
.end method

.method public constructor <init>(Ljava/lang/Long;)V
    .locals 2
    .parameter "initital"

    .prologue
    .line 56
    invoke-direct {p0}, Ljava/util/concurrent/atomic/AtomicLong;-><init>()V

    .line 57
    invoke-virtual {p1}, Ljava/lang/Long;->longValue()J

    move-result-wide v0

    invoke-virtual {p0, v0, v1}, Lcom/burstly/lib/component/networkcomponent/burstly/DayBasedCacheTimer;->set(J)V

    .line 58
    iput-object p1, p0, Lcom/burstly/lib/component/networkcomponent/burstly/DayBasedCacheTimer;->mDefaultValue:Ljava/lang/Long;

    .line 59
    return-void
.end method


# virtual methods
.method public setNewTTLValue(Ljava/lang/Long;)V
    .locals 2
    .parameter "newValue"

    .prologue
    .line 67
    if-eqz p1, :cond_0

    .line 68
    invoke-virtual {p1}, Ljava/lang/Long;->longValue()J

    move-result-wide v0

    invoke-virtual {p0, v0, v1}, Lcom/burstly/lib/component/networkcomponent/burstly/DayBasedCacheTimer;->set(J)V

    .line 70
    :cond_0
    return-void
.end method

.method public setNewTTLValue(Ljava/lang/String;)V
    .locals 8
    .parameter "newValue"

    .prologue
    const/4 v5, 0x1

    const/4 v7, 0x0

    .line 78
    if-eqz p1, :cond_0

    .line 79
    invoke-virtual {p0}, Lcom/burstly/lib/component/networkcomponent/burstly/DayBasedCacheTimer;->get()J

    move-result-wide v2

    invoke-static {v2, v3}, Lcom/burstly/lib/util/CacheUtils;->getDaysFromMillis(J)I

    move-result v0

    .line 80
    .local v0, currectValue:I
    invoke-static {v0}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v2

    invoke-static {p1, v2}, Lcom/burstly/lib/util/Utils;->getIntValue(Ljava/lang/String;Ljava/lang/Integer;)Ljava/lang/Integer;

    move-result-object v1

    .line 81
    .local v1, intValue:Ljava/lang/Integer;
    invoke-virtual {v1}, Ljava/lang/Integer;->intValue()I

    move-result v2

    invoke-static {v2}, Lcom/burstly/lib/util/CacheUtils;->getMillisFromDays(I)J

    move-result-wide v2

    invoke-virtual {p0, v2, v3}, Lcom/burstly/lib/component/networkcomponent/burstly/DayBasedCacheTimer;->set(J)V

    .line 82
    sget-object v2, Lcom/burstly/lib/component/networkcomponent/burstly/DayBasedCacheTimer;->LOG:Lcom/burstly/lib/util/LoggerExt;

    const-string v3, "DayBasedCacheTimer"

    const-string v4, "Time based cache ttl set to {0} days"

    new-array v5, v5, [Ljava/lang/Object;

    aput-object v1, v5, v7

    invoke-virtual {v2, v3, v4, v5}, Lcom/burstly/lib/util/LoggerExt;->logInfo(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    .line 87
    .end local v0           #currectValue:I
    .end local v1           #intValue:Ljava/lang/Integer;
    :goto_0
    return-void

    .line 84
    :cond_0
    sget-object v2, Lcom/burstly/lib/component/networkcomponent/burstly/DayBasedCacheTimer;->LOG:Lcom/burstly/lib/util/LoggerExt;

    const-string v3, "DayBasedCacheTimer"

    const-string v4, "No time based ttl in config from server, setting default value {0}ms"

    new-array v5, v5, [Ljava/lang/Object;

    iget-object v6, p0, Lcom/burstly/lib/component/networkcomponent/burstly/DayBasedCacheTimer;->mDefaultValue:Ljava/lang/Long;

    aput-object v6, v5, v7

    invoke-virtual {v2, v3, v4, v5}, Lcom/burstly/lib/util/LoggerExt;->logInfo(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    .line 85
    iget-object v2, p0, Lcom/burstly/lib/component/networkcomponent/burstly/DayBasedCacheTimer;->mDefaultValue:Ljava/lang/Long;

    invoke-virtual {v2}, Ljava/lang/Long;->longValue()J

    move-result-wide v2

    invoke-virtual {p0, v2, v3}, Lcom/burstly/lib/component/networkcomponent/burstly/DayBasedCacheTimer;->set(J)V

    goto :goto_0
.end method
